package com.mydubbo.demo.web;

import com.jfinal.core.Controller;
import com.mydubbo.core.MyDubboReferStarter;
import com.mydubbo.demo.UserService;

public class TestAction extends Controller {
	
	static MyDubboReferStarter starter;
	
	public void initClient() {
		starter = MyDubboReferStarter.getInstance();
		starter.addBeanRefer(UserService.class);
		starter.start();
		renderNull();
	}
	
	public void test1() {
		Object proxy = starter.getProxy(UserService.class);
		UserService userService = (UserService) proxy;
		userService.hello("zhangsan");
		renderNull();
	}
	
	public void test2() {
		Object proxy = starter.getProxy(UserService.class);
		UserService userService = (UserService) proxy;
		renderJson(userService.random(8));
	}

}
